<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
 */

Route::get('/', 'IndexController@index')->name('home')->description('控制台:首頁')->menu('控制台:首頁');
Route::get('timeline', 'IndexController@timeline')->name('timeline')->description('控制台:大紀事')->menu('控制台:大紀事');
// 其他
Route::post('upload', 'ImageController@upload')->name('image.upload')->description('其他:圖片上傳');
Route::get('example', 'IndexController@example')->name('example')->description('其他:例子');

// 後台用户管理
Route::namespace('Auth')->group(function () {

    Route::get('/login', 'AuthController@login')->name('admin.login')->description('基礎權限:登入');
    Route::post('/login', 'AuthController@auth')->name('admin.auth')->description('基礎權限:提交登入');
    Route::get('/logout', 'AuthController@logout')->name('admin.logout')->description('基礎權限:登出');

    Route::prefix('administrator')->group(function () {
        Route::get('/', 'AdministratorController@index')->name('admin.index')->description('後台用户:用户列表')->menu('後台用户:用户管理');
        Route::get('/create', 'AdministratorController@create')->name('admin.create')->description('後台用户:增加用户');
        Route::post('/store', 'AdministratorController@store')->name('admin.store')->description('後台用户:保存用户');
        Route::get('/edit/{id}', 'AdministratorController@edit')->name('admin.edit')->description('後台用户:編輯用户');
        Route::post('/edit', 'AdministratorController@update')->name('admin.update')->description('後台用户:更新用户');
        Route::any('/delete', 'AdministratorController@delete')->name('admin.delete')->description('後台用户:刪除用户');
        Route::get('/reset_password/{id}', 'AdministratorController@resetPassword')->name('admin.password.reset')->description('後台用户:重設密碼');
    });

    Route::prefix('permission')->group(function () {
        Route::get('/', 'PermissionController@index')->name('permission.index')->description('後台用户:權限列表')->menu('後台用户:權限管理');
        Route::get('/create', 'PermissionController@create')->name('permission.create')->description('後台用户:新增權限');
        Route::post('/store', 'PermissionController@store')->name('permission.store')->description('後台用户:保存權限');
        Route::get('/edit/{id}', 'PermissionController@edit')->name('permission.edit')->description('後台用户:編輯權限');
        Route::post('/edit', 'PermissionController@update')->name('permission.update')->description('後台用户:更新權限');
        Route::post('/delete', 'PermissionController@delete')->name('permission.delete')->description('後台用户:刪除權限');
    });

    Route::prefix('role')->group(function () {
        Route::get('/', 'RoleController@index')->name('role.index')->description('後台用户:角色列表')->menu('後台用户:角色管理');
        Route::get('/create', 'RoleController@create')->name('role.create')->description('後台用户:新增角色');
        Route::post('/store', 'RoleController@store')->name('role.store')->description('後台用户:保存角色');
        Route::get('/edit/{id}', 'RoleController@edit')->name('role.edit')->description('後台用户:編輯角色');
        Route::post('/edit', 'RoleController@update')->name('role.update')->description('後台用户:更新角色');
        Route::post('/delete', 'RoleController@delete')->name('role.delete')->description('後台用户:刪除角色');
        Route::get('/export', 'RoleController@export')->name('role.export')->description('後台用户:導出角色權限');
    });
});
// 操作日誌
Route::get('operation/log', 'OperationLogController@index')->name('operation.log')->description('後台用戶:操作日誌')->menu('後台用户:操作日誌');
// 個人設置
Route::prefix('profile')->group(function () {
    Route::get('/edit', 'ProfileController@edit')->name('profile.edit')->description('個人設置:修改資料');
    Route::post('/edit', 'ProfileController@update')->name('profile.update')->description('個人設置:保存資料');
    Route::get('/resetpassword', 'ProfileController@editPassword')->name('profile.password.edit')->description('個人設置:修改密碼');
    Route::post('/resetpassword', 'ProfileController@updatePassword')->name('profile.password.update')->description('個人設置:保存密碼');
});
